srm 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

srm 命令安装:


-bash/zsh: srm command not not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install secure-delete

# Debian
apt-get install secure-delete

# Ubuntu
apt-get install secure-delete

# Alpine
apk add secure-delete

# Kali Linux
apt-get install secure-delete

# Fedora
dnf install srm

# Raspbian
apt-get install secure-delete

# Docker
docker run cmd.cat/srm srm

srm 命令补充说明:


srm 会通过覆写、重命名和截断操作来处理每个指定文件,然后再将其从文件系统中移除(unlink)。这可以防止其他人通过命令行恢复或找回关于该文件的任何信息。默认情况下,srm 使用简单模式覆写文件内容。你可以通过 --dod--doe--openbsd--rcmp--gutmann 选项选择不同的覆写模式。如果指定了多个模式选项,则以最后一个选项为准。

也可以使用 srm 覆写块设备。覆写完成后,设备节点不会被删除。此功能在 Linux 系统上可用。拥有多个硬链接的文件会被解除链接(unlink),但不会被覆写。

srm 和所有使用 getopt 函数解析参数的程序一样,支持使用 -- 选项来指示其后所有参数都视为非选项参数。要删除当前目录下名为 -f 的文件

srm 命令语法:


srm [OPTION]... FILE...
srm [-r] [-s|-m|-z] [-f] [-v] files

srm 命令选项:


-d, --directory

ignored (for compatibility with rm(1))
-f, --force

ignore nonexistent files, never prompt
-i, --interactive

prompt before any removal
-r, -R, --recursive

remove the contents of directories recursively
-x, --one-file-system

when removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument. (Not supported on Windows)
-s, --simple

Overwrite the file with a single pass of 0x00 bytes. This is the default mode.
-P, --openbsd

OpenBSD compatible rm. Files are overwritten three times, first with the byte 0xFF, then 0x00, and then 0xFF again, before they are deleted.
-D, --dod

US Dod compliant 7-pass overwrite.
-E, --doe

US DoE compliant 3-pass overwrite. Twice with a random pattern, finally with the bytes "DoE". See http://cio.energy.gov/CS-11_Clearing_and_Media_Sanitization_Guidance.pdf for details.
-G, --gutmann

Use the 35-pass Gutmann method. See http://en.wikipedia.org/wiki/Gutmann_method for details.
-C, --rcmp

Royal Canadian Mounted Police compliant 3-pass overwrite. First pass writes 0x00 bytes. Second pass writes 0xFF bytes. Third pass writes "RCMP". See https://www.cse-cst.gc.ca/en/node/270/html/10572 for details.
-v, --verbose

explain what is being done. Specify this option multiple times to increase verbosity.
-h, --help

display this help and exit.
-V, --version

output version information and exit.

srm 命令实例:


srm 的 -s 用随机数据单次覆盖后删除文件 - Simple overwrite (faster):

srm -s path/to/file

srm 的 -m 用随机数据覆盖七次后删除文件 - Medium security (7 passes):

srm -m path/to/file

srm 递归删除目录及其内容,并用随机数据单次覆盖每个文件:

srm -r -s path/to/directory

srm 的 -i 每次删除前提示:

srm -i \*

srm 安全删除文件:

srm [file.txt]

srm 的 -z 最高安全性(38 次覆盖)删除文件

srm -z [file.txt]

srm 详细输出

srm -v [file.txt]

srm 强制删除文件 - Forece:

srm -f [file.txt]

srm 命令扩展阅读:


 

CommandNotFound ⚡️ 坑否 - 其他频道扩展阅读:




srm 命令评论

共收录到 549Linux 命令